<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AngelScript: asrun manual</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="aslogo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AngelScript
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('doc_samples_asrun_manual.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">asrun manual </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>asrun is a simple command-line tool that supports executing AngelScript files directly in order to perform simple batch tasks. The API provided by the tool allow the script to interact with the system to read and write files, and execute other system commands.</p>
<p>On Windows it can be associated, for example with the file extension .as, to allow scripts to be executed directly from the file browser with a double click. This makes it a handy tool even without a terminal for command-line input.</p>
<h1><a class="anchor" id="doc_samples_asrun_usage"></a>
Usage</h1>
<pre>
asrun [-d] &lt;script file&gt; [&lt;args&gt;]
 -d             inform if the script should be runned with debug
 &lt;script file&gt;  is the script file that should be runned
 &lt;args&gt;         zero or more args for the script
</pre><p>These usage instructions are also presented if the tool is executed without any arguments.</p>
<h1><a class="anchor" id="doc_samples_asrun_script"></a>
Scripts</h1>
<p>As entry point for executing the scripts, asrun looks for one of the functions <code>int main()</code> or <code>void main()</code>. If neither of these functions are found an error will be reported.</p>
<p>The scripts can use the full set of the script language and standard library described in <a class="el" href="doc_script.html">the script language</a> section of this manual. In addition to that a few functions specific to asrun are available as described in <a class="el" href="doc_samples_asrun_manual.html#doc_samples_asrun_funcs">the next section</a>.</p>
<p>The script file informed as input on the command line may include additional files with the include directive <code>#include "&lt;file name&gt;"</code>, so that the script files can be better organized and common logic shared between multiple scripts.</p>
<h2><a class="anchor" id="doc_samples_asrun_funcs"></a>
Global functions available to scripts</h2>
<p>Besides the <a class="el" href="doc_script_stdlib.html">standard library</a>, the following functions are also exposed to the scripts.</p>
<p><b>void print(const string &amp;in line)</b></p>
<p>Prints a line to the standard output.</p>
<p><b>string getInput()</b></p>
<p>Gets a line from the standard input.</p>
<p><b>array&lt;string&gt; @getCommandLineArgs()</b></p>
<p>Gets the command line arguments as an array.</p>
<p><b>int exec(const string &amp;in)</b></p>
<p>Executes a system command.</p>
<h1><a class="anchor" id="doc_samples_asrun_debug"></a>
How to debug scripts</h1>
<p>To run a script with the debugger, either add the command line argument -d or include <code>#pragma debug</code> in the script. When this is done, the debugger will show a prompt like this:</p>
<pre>
Debugging, waiting for commands. Type 'h' for help.
[dbg]&gt;
</pre><p>This will then let you set up breakpoints, step through the code, inspect variables, etc. Type <code>h</code> on the prompt to get the list of commands available. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Sun Sep 22 2019 11:47:55 for AngelScript by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.16 </li>
  </ul>
</div>
</body>
</html>
